<?php
class Client
{
    public $client;
    public function __construct() {
        $this->client = new swoole_client(SWOOLE_SOCK_TCP);
        if( !$this->client->connect("0.0.0.0", 9599 , 1) ) {
            echo "Connect Error";
        }
    }
    
    
    function dosend($params){
        $data = array(
            //"url" =>  "http://oa.g-town.com.cn:8008/exp/query/{$params}" ,
            "url" =>  "http://192.168.1.8:8008/exp/query/{$params}" ,
            "param"=>''
                );
        $json_data = json_encode($data)."\r\n";
        $this->client->send( $json_data );
    }
}




$limit = " 0,1000 ";
$pdo = new \PDO("mysql:host=192.168.1.7;dbname=g-townOA","root","",array (\PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES'utf8';"));
$rs = $pdo -> query("SELECT DISTINCT  expNo,expCom from think_expresslog  where expStatus='-1'  limit {$limit}");
$count = 0;
$client = new Client();

while($vo = $rs -> fetch()){
    $data = "code/{$vo['expNo']}/expCom/{$vo['expCom']}";
    $client->dosend($data);
    $count++;
}

echo "SUCCESS-{$count}";
